package com.song.estore.domain;

/**
 * Created by 范姣姣 on 2015/10/22.
 */
public class Product {
    private int id;
    private String name;
    private String category;
    private double marketprice;
    private double estoreprice;
    private int pnum;
    private String imgurl;
    private String description;

    public Product() {
    }

    public Product(String name, String category, double marketprice, double estoreprice, int pnum, String imgurl, String description) {
        this.name = name;
        this.category = category;
        this.marketprice = marketprice;
        this.estoreprice = estoreprice;
        this.pnum = pnum;
        this.imgurl = imgurl;
        this.description = description;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public double getMarketprice() {
        return marketprice;
    }

    public void setMarketprice(double marketprice) {
        this.marketprice = marketprice;
    }

    public double getEstoreprice() {
        return estoreprice;
    }

    public void setEstoreprice(double estoreprice) {
        this.estoreprice = estoreprice;
    }

    public int getPnum() {
        return pnum;
    }

    public void setPnum(int pnum) {
        this.pnum = pnum;
    }

    public String getImgurl() {
        return imgurl;
    }

    public void setImgurl(String imgurl) {
        this.imgurl = imgurl;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Product product = (Product) o;

        if (id != product.id) return false;
        if (Double.compare(product.marketprice, marketprice) != 0) return false;
        if (Double.compare(product.estoreprice, estoreprice) != 0) return false;
        if (pnum != product.pnum) return false;
        if (name != null ? !name.equals(product.name) : product.name != null) return false;
        if (category != null ? !category.equals(product.category) : product.category != null) return false;
        if (imgurl != null ? !imgurl.equals(product.imgurl) : product.imgurl != null) return false;
        if (description != null ? !description.equals(product.description) : product.description != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = id;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (category != null ? category.hashCode() : 0);
        temp = Double.doubleToLongBits(marketprice);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        temp = Double.doubleToLongBits(estoreprice);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + pnum;
        result = 31 * result + (imgurl != null ? imgurl.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Product{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", category='" + category + '\'' +
                ", marketprice=" + marketprice +
                ", estoreprice=" + estoreprice +
                ", pnum=" + pnum +
                ", imgurl='" + imgurl + '\'' +
                ", description='" + description + '\'' +
                '}';
    }
}
